﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TerritoryGame.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class InitCreate4 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_user_levels_users_UserId",
                table: "user_levels");

            migrationBuilder.RenameColumn(
                name: "Id",
                table: "user_levels",
                newName: "id");

            migrationBuilder.RenameColumn(
                name: "UserId",
                table: "user_levels",
                newName: "user_id");

            migrationBuilder.RenameColumn(
                name: "UpdatedAt",
                table: "user_levels",
                newName: "updated_at");

            migrationBuilder.RenameColumn(
                name: "UnlockedTitles",
                table: "user_levels",
                newName: "unlocked_titles");

            migrationBuilder.RenameColumn(
                name: "TotalExperience",
                table: "user_levels",
                newName: "total_experience");

            migrationBuilder.RenameColumn(
                name: "LastLevelUpTime",
                table: "user_levels",
                newName: "last_level_up_time");

            migrationBuilder.RenameColumn(
                name: "IsDeleted",
                table: "user_levels",
                newName: "is_deleted");

            migrationBuilder.RenameColumn(
                name: "IsActive",
                table: "user_levels",
                newName: "is_active");

            migrationBuilder.RenameColumn(
                name: "CurrentTitle",
                table: "user_levels",
                newName: "current_title");

            migrationBuilder.RenameColumn(
                name: "CurrentLevel",
                table: "user_levels",
                newName: "current_level");

            migrationBuilder.RenameColumn(
                name: "CurrentExperience",
                table: "user_levels",
                newName: "current_experience");

            migrationBuilder.RenameColumn(
                name: "CreatedAt",
                table: "user_levels",
                newName: "created_at");

            migrationBuilder.RenameIndex(
                name: "IX_user_levels_UserId",
                table: "user_levels",
                newName: "IX_user_levels_user_id");

            migrationBuilder.AlterColumn<DateTime>(
                name: "updated_at",
                table: "user_levels",
                type: "timestamp with time zone",
                nullable: false,
                defaultValue: new DateTime(2025, 8, 18, 6, 22, 5, 596, DateTimeKind.Utc).AddTicks(8238),
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone");

            migrationBuilder.AlterColumn<bool>(
                name: "is_deleted",
                table: "user_levels",
                type: "boolean",
                nullable: false,
                defaultValue: false,
                oldClrType: typeof(bool),
                oldType: "boolean");

            migrationBuilder.AlterColumn<bool>(
                name: "is_active",
                table: "user_levels",
                type: "boolean",
                nullable: false,
                defaultValue: true,
                oldClrType: typeof(bool),
                oldType: "boolean");

            migrationBuilder.AlterColumn<DateTime>(
                name: "created_at",
                table: "user_levels",
                type: "timestamp with time zone",
                nullable: false,
                defaultValue: new DateTime(2025, 8, 18, 6, 22, 5, 596, DateTimeKind.Utc).AddTicks(8032),
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone");

            migrationBuilder.AddForeignKey(
                name: "FK_user_levels_users_user_id",
                table: "user_levels",
                column: "user_id",
                principalTable: "users",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_user_levels_users_user_id",
                table: "user_levels");

            migrationBuilder.RenameColumn(
                name: "id",
                table: "user_levels",
                newName: "Id");

            migrationBuilder.RenameColumn(
                name: "user_id",
                table: "user_levels",
                newName: "UserId");

            migrationBuilder.RenameColumn(
                name: "updated_at",
                table: "user_levels",
                newName: "UpdatedAt");

            migrationBuilder.RenameColumn(
                name: "unlocked_titles",
                table: "user_levels",
                newName: "UnlockedTitles");

            migrationBuilder.RenameColumn(
                name: "total_experience",
                table: "user_levels",
                newName: "TotalExperience");

            migrationBuilder.RenameColumn(
                name: "last_level_up_time",
                table: "user_levels",
                newName: "LastLevelUpTime");

            migrationBuilder.RenameColumn(
                name: "is_deleted",
                table: "user_levels",
                newName: "IsDeleted");

            migrationBuilder.RenameColumn(
                name: "is_active",
                table: "user_levels",
                newName: "IsActive");

            migrationBuilder.RenameColumn(
                name: "current_title",
                table: "user_levels",
                newName: "CurrentTitle");

            migrationBuilder.RenameColumn(
                name: "current_level",
                table: "user_levels",
                newName: "CurrentLevel");

            migrationBuilder.RenameColumn(
                name: "current_experience",
                table: "user_levels",
                newName: "CurrentExperience");

            migrationBuilder.RenameColumn(
                name: "created_at",
                table: "user_levels",
                newName: "CreatedAt");

            migrationBuilder.RenameIndex(
                name: "IX_user_levels_user_id",
                table: "user_levels",
                newName: "IX_user_levels_UserId");

            migrationBuilder.AlterColumn<DateTime>(
                name: "UpdatedAt",
                table: "user_levels",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone",
                oldDefaultValue: new DateTime(2025, 8, 18, 6, 22, 5, 596, DateTimeKind.Utc).AddTicks(8238));

            migrationBuilder.AlterColumn<bool>(
                name: "IsDeleted",
                table: "user_levels",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean",
                oldDefaultValue: false);

            migrationBuilder.AlterColumn<bool>(
                name: "IsActive",
                table: "user_levels",
                type: "boolean",
                nullable: false,
                oldClrType: typeof(bool),
                oldType: "boolean",
                oldDefaultValue: true);

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreatedAt",
                table: "user_levels",
                type: "timestamp with time zone",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp with time zone",
                oldDefaultValue: new DateTime(2025, 8, 18, 6, 22, 5, 596, DateTimeKind.Utc).AddTicks(8032));

            migrationBuilder.AddForeignKey(
                name: "FK_user_levels_users_UserId",
                table: "user_levels",
                column: "UserId",
                principalTable: "users",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
